<?php
require_once ('../fun/functions.php');
if(isset($_POST['card_num'])) {
	require_once '../inc/anet_php_sdk/AuthorizeNet.php'; // Make sure this path is correct.
	$transaction = new AuthorizeNetAIM($apiLoginID, $transKey);

		$transaction->amount = $_POST['price'];
		$transaction->card_num = $_POST['card_num'];
	  	$transaction->exp_date = $_POST['exp_date'];
	  		$response = $transaction->authorizeAndCapture();
}
/*  
		vvv From authorize.net vvv

	require_once ('../fun/functions.php');
	require_once ('../inc/anet_php_sdk/AuthorizeNet.php'); // Make sure this path is correct.
	$transaction = new AuthorizeNetAIM($apiLoginID, $transKey);
	$transaction->amount = '9.99';
	$transaction->card_num = '4007000000027';
	$transaction->exp_date = '10/16';
	
		$response = $transaction->authorizeAndCapture();

	if ($response->approved) {
	  echo "<h1>Success! The test credit card has been charged!</h1>";
	  echo "Transaction ID: " . $response->transaction_id;
	} else {
	  echo $response->error_message;
	}*/
?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Vocabulary | &psi; Psychology Database &psi;</title>
<? include ("../inc/required-links.php") ?>
</head>
<body>
<div id="wrapper">
	<div id="l_l"></div> 
    <div id="left">
		<?php include ('../nav/nav.php') ?>
    </div>
    <div id="main">
		<?php include ('../inc/header.php') ?>
        <div id="t_bg"></div>
        <div id="content">
			<div class="otstup">
            	<div id="main_left">
            <!--<pre><? // if (isset($response)) { print_r($response); } ?></pre>-->
				<?
                    if ($response->approved) {
                      echo "<h1>Success! The test credit card has been charged!</h1>";
                      echo "Transaction ID: " . $response->transaction_id;
                    } else {
                      echo $response->error_message;
                    }
                ?>
                <p style="color:red;">**Within are test values only, transactions don't work!**<br /><span style="text-decoration:blink;">DO NOT ENTER YOUR REAL INFORMATION!!!</span></p>
            <form action="?" method="post">
                Price: <input type="number" name="price" /> <br />
                Credit Card Number: <input type="text" name="card_num" value="4007000000027" /> <br />
                Experation Date: <input type="date" name="exp_date" value="10/16" /><br /><br />
                <input class="btn btn-mini" type="submit" value="Buy Now" />
            </form>
        <div id="fb-root"></div>
                <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) return;
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));</script>
                </div>
                <div id="right">
					<?php include ('../inc/cat_box1.php') ?>
					<?php include ('../inc/cat_box2.php') ?>
					<?php include ('../inc/cat_box3.php') ?>
					<?php include ('../inc/cat_box4.php') ?>
					<?php include ('../inc/sn_links.php') ?>
                </div>
        		<div class="clear"></div>
        	</div>
        </div>
        <div class="clear"></div>  
        <div id="foot">
        	<?php include ('../inc/footer.php') ?>
		</div>
		<?php include ('../inc/copywright.php') ?>
        </div>
<div class="clear"></div> 
</div>
</body>
</html>
<? include ("../inc/required-js.php") ?>